package com.miso.shop.controller;

import java.util.Calendar;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.miso.shop.model.DdongVO0010;
import com.miso.shop.model.DdongVO0030;
import com.miso.shop.service.DdongService0010;
import com.miso.shop.service.DdongService0030;



/**
 * @author mh.jeong
 * @Description : 怨좉컼�곷떞硫붿씤�붾㈃-�듯솕�덉빟�깅줉
 * @Class : com.hyundaicard.privia.counsel.cns.CnsController0090
 * <pre>
 * 2013.04.18 jh.choi �좉퇋�앹꽦
 * </pre>
 * @version : 1.0
 */
@Controller
@RequestMapping("/daum/ddongs/")
public class DaumCafeController0030 {
    private static Logger logger = LoggerFactory.getLogger(DaumCafeController0030.class);
	private final static String PROGRAM_ID = "daum.ddongs";
	private final static String programUrl = PROGRAM_ID.replaceAll("\\.", "/");
	/** Wfm0010 Service */
	@Resource(name = "ddongService0030")
    private DdongService0030 ddongService0030;


	
	/** 
	 * @Method		: �몄텧 �붾㈃
	 * @author		: jh.choi
	 * @Locaton		: com.hyundaicard.privia.counsel.cns.CnsController0090
	 * @Description	: �듯솕�덉빟�깅줉 �붾㈃���몄텧�쒕떎.
	 * @param		: model
	 * @return		: String
	 * @throws Exception 
	 */
	@RequestMapping("/bannerWeek")  //어노테이션 설정 /main으로 url요청이 들어오면 이 컨트롤러로 매핑하겠단 뜻.
	public String ddong0030 (
			Model model) {
System.out.println("====================================================1111");

		return programUrl + "/ddong0030";
	}
	
	/** 
	 * @Method		: setCustRrvInfo
	 * @author		: jh.choi
	 * @Locaton		: com.hyundaicard.privia.counsel.cns.CnsController0090
	 * @Description	: �듯솕�덉빟 ��옣
	 * @param		: CnsVO0090, Model
	 * @return		: String
	 * @throws Exception 
	 */
	@RequestMapping("ddong0030.getBannerWeek")
	public @ResponseBody List<DdongVO0030> setCustRrvInfo(
			@ModelAttribute("vo") DdongVO0030 vo,
			Model model) {

        //logger.debug("########### : "+vo.getShop_name());
		//CnsVO0110 vo = new CnsVO0110();
		Calendar c = Calendar.getInstance();

		System.out.println("====================================================1111"+c.get(Calendar.DAY_OF_WEEK));
		
		vo.setWeekday(c.get(Calendar.DAY_OF_WEEK));
		
		List<DdongVO0030> result = ddongService0030.list ("miso.ddong.mysql.DDONG0030_getBannerWeek_SEL", vo);
		//System.out.println("====================================================3131"+result.get(0).getShop_name());


		return result;
	}
}